how to use clamav on macOS Mojave

  1. installation

    I guess you have installed macports.

    sudo port install clamav
    
  2. configuration

    cd /opt/local/etc
    sudo mv freshclam.conf.sample freshclam.conf
    sed -i ".bak" 's/Example//g' freshclam.conf
    sed -i "" 's/#DatabaseDirectory/DatabaseDirectory/g' freshclam.conf
    sudo mkdir -p /var/lib/clamav
    sudo chown -R clamav /var/lib/clamav/
    
  3. update and scan

    sudo freshclam
    cd /
    sudo clamscan -r